AddComment
Adds a comment to the specifed document element or array of Runs.
Syntax
expression.AddComment(element, text, author, userId);
expression
- A variable that represents a Api class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
element | Required | ApiRun[] | DocumentElement | |
text | Required | string | The comment text (required). | |
author | Required | string | The author's name (optional). | |
userId | Required | string | The user ID of the comment author (optional). |
Returns
Example
This example adds text and comment to the first paragraph.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
Api.AddComment(paragraph, "ONLYOFFICE for developers", "Jane");